package com.spsoft.vatoutinv.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.spsoft.core.annotation.AnonymousAccess;
import com.spsoft.core.annotation.Log;
import com.spsoft.core.enums.LogActionType;
import com.spsoft.core.enums.LogMenuEnum;
import com.spsoft.core.enums.ResponseEnum;
import com.spsoft.core.model.Result;
import com.spsoft.vatoutinv.model.dto.vmsrealregionalconfig.VmsRealRegionalConfigAddDTO;
import com.spsoft.vatoutinv.model.dto.vmsrealregionalconfig.VmsRealRegionalConfigDTO;
import com.spsoft.vatoutinv.model.dto.vmsrealregionalconfig.VmsRealRegionalConfigUpdateDTO;
import com.spsoft.vatoutinv.model.vo.vmsrealregionalconfig.VmsRealRegionalConfigListVO;
import com.spsoft.vatoutinv.model.vo.vmsrealregionalconfig.VmsRealRegionalConfigPageVO;
import com.spsoft.vatoutinv.model.vo.vmsrealregionalconfig.VmsRealRegionalConfigVO;
import com.spsoft.vatoutinv.service.vmsrealregionalconfig.VmsRealRegionalConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Objects;

/**
 * @Author wangy
 * @Desc (VmsRealRegionalConfig)表控制层
 * @Date 2024-03-22 14:44:01
 */
@Api(tags = "行政区域维护")
@RestController
@RequestMapping("vmsRealRegionalConfig")
@RequiredArgsConstructor
@Validated
@Slf4j
public class VmsRealRegionalConfigController {

    private final VmsRealRegionalConfigService vmsRealRegionalConfigService;

    @ApiOperation("行政区域维护-分页查询")
    @AnonymousAccess(value = "/queryByPage", method = RequestMethod.POST, permissionCode = "VMS_REAL_REGIONAL_CONFIG")
    @Log(value = "行政区域维护-分页查询", type = LogActionType.SELECT, menuName = LogMenuEnum.VMS_REAL_REGIONAL_CONFIG)
    public Result<IPage<VmsRealRegionalConfigPageVO>> queryByPage(@RequestBody VmsRealRegionalConfigDTO param) {
        return vmsRealRegionalConfigService.queryByPage(param);
    }

    @ApiOperation("行政区域维护-新增数据")
    @AnonymousAccess(value = "/insert", method = RequestMethod.POST, permissionCode = "VMS_REAL_REGIONAL_CONFIG_ADD")
    @Log(value = "行政区域维护-新增数据", type = LogActionType.ADD, menuName = LogMenuEnum.VMS_REAL_REGIONAL_CONFIG)
    public Result<Long> insert(@RequestBody VmsRealRegionalConfigAddDTO param) {
        return vmsRealRegionalConfigService.insert(param);
    }

    @ApiOperation("行政区域维护-根据ID查详情")
    @AnonymousAccess(value = "/queryById", method = RequestMethod.POST, permissionCode = "VMS_REAL_REGIONAL_CONFIG")
    @Log(value = "行政区域维护-根据ID查详情", type = LogActionType.SELECT, menuName = LogMenuEnum.VMS_REAL_REGIONAL_CONFIG)
    public Result<VmsRealRegionalConfigVO> queryById(@RequestBody VmsRealRegionalConfigDTO param) {
        return vmsRealRegionalConfigService.queryById(param.getId());
    }

    @ApiOperation("行政区域维护-删除数据")
    @Log(value = "行政区域维护-删除数据", type = LogActionType.DELETE, menuName = LogMenuEnum.VMS_REAL_REGIONAL_CONFIG)
    @AnonymousAccess(value = "/deleteById", method = RequestMethod.POST, permissionCode = "VMS_REAL_REGIONAL_CONFIG_DELETE")
    public Result<Long> deleteById(@RequestBody VmsRealRegionalConfigDTO param) {
        return vmsRealRegionalConfigService.deleteById(param.getId());
    }

    @ApiOperation("行政区域维护-获取省级区域")
    @Log(value = "行政区域维护-获取省级区域", type = LogActionType.SELECT, menuName = LogMenuEnum.VMS_REAL_REGIONAL_CONFIG)
    @AnonymousAccess(value = "/getProvince", method = RequestMethod.POST, permissionCode = "VMS_REAL_REGIONAL_CONFIG")
    public Result<List<VmsRealRegionalConfigVO>> getProvince() {
        return vmsRealRegionalConfigService.getProvince();
    }

    @ApiOperation("行政区域维护-修改状态")
    @Log(value = "行政区域维护-修改状态", type = LogActionType.UPDATE, menuName = LogMenuEnum.VMS_REAL_REGIONAL_CONFIG)
    @AnonymousAccess(value = "/updateStatus", method = RequestMethod.POST, permissionCode = "VMS_REAL_REGIONAL_CONFIG_ADD")
    public Result<Object> updateStatus(@RequestBody VmsRealRegionalConfigDTO param) {
        return vmsRealRegionalConfigService.updateStatus(param);
    }

    @ApiOperation("行政区域维护-获取列表")
    @Log(value = "行政区域维护-获取列表", type = LogActionType.SELECT, menuName = LogMenuEnum.VMS_REAL_REGIONAL_CONFIG)
    @AnonymousAccess(value = "/getList", method = RequestMethod.POST, permissionCode = "")
    public Result<List<VmsRealRegionalConfigListVO>> getList() {
        return vmsRealRegionalConfigService.getList();
    }

}
